package com.proxies;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Created by li_wb on 2017/12/15.
 */
public class LogInvocationHandler implements InvocationHandler {
    private Object targetObject;

    public LogInvocationHandler(Object targetObject) {
        this.targetObject = targetObject;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Object rev = method.invoke(targetObject, args);
        System.out.println("记录日志=" + this.getClass().getName());
        return rev;
    }
}
